package android.framework.widget.slidemenu;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;

/** 
* @ClassName: SlidingMenu 
* @Description:  
* @author jtf19@163.com
* @date 2013-3-22 ����14:15:11 
*  
*/ 
public class SlidingMenu extends RelativeLayout {

	private SlidingView mSlidingView;//��˵����м�����ҳ��View
	private View mLeftView;//�˵�View
	private int alignScreenWidth;//�˵�չ���Ŀ��

	public SlidingMenu(Context context) {
		super(context);
	}

	public SlidingMenu(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public SlidingMenu(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public void setAlignScreenWidth(int alignScreenWidth) {
		this.alignScreenWidth = alignScreenWidth;
	}

	public void setLeftView(View view) {
		LayoutParams behindParams = new LayoutParams(alignScreenWidth,
				LayoutParams.MATCH_PARENT);
		addView(view, behindParams);
		mLeftView = view;
	}

	public void setCenterView(View view) {
		LayoutParams aboveParams = new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT);
		mSlidingView = new SlidingView(getContext());
		addView(mSlidingView, aboveParams);
		mSlidingView.setView(view);
		mSlidingView.invalidate();
		mSlidingView.setLeftView(mLeftView);
	}

	public void showLeftView() {
		mSlidingView.showLeftView();
	}

	public void showCenterView() {
		mSlidingView.showCenterView();
	}
	
	public boolean getMenuOpenState(){
		return mSlidingView.getMenuOpenState();
	}

}
